package com.hengtongxing.hejiayun.base;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;


/**
 * Time: 2019/8/8
 * Author: ZF
 * Description:
 */

public abstract class BaseAdapter_Recycler extends RecyclerView.Adapter<BaseViewHolder> {


    public OnItemClickListener mOnItemClickListener;
    public Context mContext;
    private int mLayoutId;

    public BaseAdapter_Recycler(Context context, int layoutId) {
        this.mContext = context;
        this.mLayoutId = layoutId;
    }

    public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
        this.mOnItemClickListener = onItemClickListener;
    }

    @NonNull
    @Override
    public BaseViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new BaseViewHolder(LayoutInflater.from(mContext).inflate(mLayoutId, parent, false));
    }

    public interface OnItemClickListener {
        void onItemClick(View view);
    }
}
